package ModelLayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class PersonTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class PersonTest
{
    /**
     * Default constructor for test class PersonTest
     */
    public PersonTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }

    @Test
    public void testSetId()
    {
        ModelLayer.Person person2 = new ModelLayer.Person();
        person2.setId(2);
        assertEquals(2, person2.getId());
    }

    @Test
    public void testGetId()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setId(3);
        assertEquals(3, person1.getId());
    }

    
    @Test
    public void testSetName()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setName("Ivo");
        assertEquals("Ivo",person1.getName());
    }
 
    @Test
    public void testGetName()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setName("Ivo");
        assertEquals("Ivo",person1.getName());
    }
    
    
    @Test
    public void testSetAddress()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setAddress("Kastata");
        assertEquals("Kastata",person1.getAddress());
    }
    
    
    @Test
    public void testGetAddress()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setAddress("Kastata");
        assertEquals("Kastata",person1.getAddress());
    }
    
    
    
    @Test
    public void testSetPostalcode()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setPostalcode(1234);
        assertEquals(1234,person1.getPostalcode());
    }
    
    @Test
    public void testGetPostalcode()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setPostalcode(1234);
        assertEquals(1234,person1.getPostalcode());
    }
    
    
    @Test 
    public void testSetCity()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setCity("Sofia");
        assertEquals("Sofia",person1.getCity());
    }
    
    
    @Test
    public void testGetCity()
    {
        ModelLayer.Person person1 = new ModelLayer.Person();
        person1.setCity("Sofia");
        assertEquals("Sofia",person1.getCity());
    }
    
    
    
    
    @Test
    public void testSetPhone()
    {
        Person person1 = new Person();
        person1.setPhone(124365);
        assertEquals(124365,person1.getPhone());
    }
    
    
    
    @Test
    public void testGetPhone()
    {
        Person person1 = new Person();
        person1.setPhone(124365);
        assertEquals(124365,person1.getPhone());
    }
    
     @Test
     public void testGetLoan()
     { 
           DVD dvd = new DVD(0, "Dvd", "DMX", 156);
           DVDRecords.getInstance().addDVD(dvd);
           Copy copy = new Copy(0, 15, 15, dvd);
           Person person = new Person(0, "Ivcho", "Otsreshta", 1517, "Sofia", 12); 
           Loan loan = new Loan(0,0,0,0,0,0,"hi");           
           person.setLoan(loan);
           assertNotNull(person.getLoan(0));
     }    
}



